<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> websocket 模拟
    </title>
</head>

<body>

    <h1>websocket 模拟</h1>



    <script>

    const socket = new WebSocket('ws://localhost:3000/path1');

			socket.addEventListener('open', function (event) {
			    socket.send('Hello Server!');
			});

			socket.addEventListener('message', function (event) {
			    console.log('Message from server ', event.data);
			});
    </script>

</body>

</html>